import http from '@/utils/http';

export interface Data {
  totalAmount: number;
  userAddressList: any[];
  tradeNo: string;
  totalNum: number;
  originalTotalAmount: number;
  couponInfoList: any[];
  detailArrayList: DetailArrayList[];
  activityReduceAmount: number;
  orderDetailVoList: OrderDetailVoList[];
}

export interface OrderDetailVoList {
  orderDetailList: DetailArrayList[];
  activityRule?: any;
}

export interface DetailArrayList {
  id?: any;
  orderId?: any;
  skuId: number;
  skuName: string;
  imgUrl: string;
  orderPrice: number;
  skuNum: number;
  createTime?: any;
  sourceType: string;
  sourceId: number;
  splitTotalAmount?: any;
  splitActivityAmount?: any;
  splitCouponAmount?: any;
  refundStatus: string;
  refundStatusString: string;
  hasStock?: any;
  activityRule?: any;
  couponInfoList?: any;
}
//订单交易也
export const tradeList = () => {
  return http.get<any,Data>('/api/order/auth/trade');
};


export const submitOrder = (tradeNo:string,parms:RootObject)=>{
  return http.post<any,null>(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`,parms)
}

interface RootObject {
  consignee: string;
  consigneeTel: string;
  deliveryAddress: string;
  paymentWay: string;
  orderComment: string;
  orderDetailList: OrderDetailList[];
}

interface OrderDetailList {
  id?: any;
  orderId?: any;
  skuId: number;
  skuName: string;
  imgUrl: string;
  orderPrice: number;
  skuNum: number;
  hasStock?: any;
}